package com.zhongfl.crm.model.boss;

import com.zhongfl.crm.enums.boss.OrderStatus;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;

/**
 * 根据订单状态进行统计结果
 *
 * @author wang.yuchuan
 * @date 2018/5/11
 */

public class OrderStatusStatisticsResult implements Serializable {

    private static final long serialVersionUID = 8400051024537119608L;

    public OrderStatusStatisticsResult(OrderStatus status) {
        this.status = status;
        this.count = 0;
        this.amount = BigDecimal.ZERO;
    }

    public OrderStatusStatisticsResult() {
        this.count = 0;
        this.amount = BigDecimal.ZERO;
    }

    @Setter
    @Getter
    private OrderStatus status;

    @Setter
    @Getter
    private String statusName;

    public String getStatusName() {
        if (StringUtils.isNotEmpty(statusName)) {
            return statusName;
        }
        if (Objects.nonNull(status)) {
            return status.getValue();
        }
        return StringUtils.EMPTY;
    }

    @Setter
    @Getter
    private String workOrderTypeCode;

    /**
     * 单量
     */
    @Setter
    @Getter
    private Integer count;

    /**
     * 金额
     */
    @Setter
    @Getter
    private BigDecimal amount;

    /**
     * 今日入库数量
     */
    @Setter
    @Getter
    private Integer inStoreCount;

    /**
     * 今日出库数量
     */
    @Setter
    @Getter
    private Integer outStoreCount;

    /**
     * 状态编号（微信端接口需要）
     */
    @Setter
    @Getter
    private Integer index;

    public OrderStatusStatisticsResult(OrderStatus status, Integer count) {
        this.status = status;
        this.count = count;
    }

    public OrderStatusStatisticsResult(OrderStatus status, Integer count, BigDecimal amount) {
        this(status, count);
        this.amount = amount;
    }

    /**
     * 当前库未读消息通知
     */
    @Setter
    @Getter
    private List<MessageNotice> notices;
}
